<?php include_once './application/views/sys_admin/common/header.php';  ?>
<div class=" definewidth m20">
	<form  method="post" id="linksForm" name="linksForm" enctype="multipart/form-data">
		<input  type="hidden" name="type" id="type" value="<?php echo $type; ?>" />
		<font color="red"><?php echo @validation_errors(); ?></font>
		<table class="table table-bordered table-hover m10">
			<tr>
		        <td class="tableleft"> 名称</td>
		        <td><input type="text" name="webname" id="webname" size="50" value="<?php echo @set_value('webname');?>" /> </td>
		    </tr>
		    <tr>
		        <td class="tableleft">上传LOGO </td>
		        <td><input type="file" name="thumbnail" id="thumbnail" /> </td>
		    </tr>
		    <tr>
		        <td class="tableleft">链接地址 </td>
		        <td><input type="text" name="url" id="url" size="50"  value="<?php echo @set_value('url');?>" /></td>
		    </tr>
		    <tr>
		        <td class="tableleft">排序</td>
		        <td><input type="text" name="forder" id="forder" value="<?php echo @set_value('forder')?set_value('forder'):0;?>" /></td>
		    </tr>
		    <tr>
		        <td class="tableleft"> <?php if($type == 2){echo '添加底部交换链接';}else{ echo '添加合作伙伴';}?>描述</td>
		        <td><textarea name="desc" id="desc" rows="5" cols="50"></textarea></td>
		    </tr>
		    <tr>
		        <td class="tableleft"> </td>
		        <td><button type="button" class="btn btn-primary"  onclick="linkSubmit();" >提交</button> </td>
		    </tr>
		</table>
			
</div>
<script type="text/javascript">
function linkSubmit(){
	var options = {
		url : '/sys_admin/links/add/',
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg=='1'){
				alert("操作成功");

				<?php if($type == 2){?>
				window.location.href ='/sys_admin/links/zhs_linkslist/?type=<?php echo $type;?>';
				<?php }else{?>
				window.location.href ='/sys_admin/links/zhs_linkslist';
				<?php }?>
			}else{
				alert(ret.msg);
			}
			
		}
	};
	$("#linksForm").ajaxSubmit(options);
	return false;
}
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
